From d5fb6a009c1a3da56a9a123a31ff4fd0d7919f28 Mon Sep 17 00:00:00 2001 From: tsteven4 Date: Tue, 3 Jul 2018 14:54:00 -0600 Subject: [PATCH] eliminate some uneccessary passing by value in favor of pass by const reference. (#216) --- defs.h | 4 ++-- main.cc | 2 +- src/core/datetime.h | 4 ++-- waypt.cc | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/defs.h b/defs.h index eb5a0be10..cc2c48e5b 100644 --- a/defs.h +++ b/defs.h @@ -548,8 +548,8 @@ public: const QList GetUrlLinks() const; void AddUrlLink(const UrlLink& l); QString CreationTimeXML() const; - gpsbabel::DateTime GetCreationTime() const; - void SetCreationTime(gpsbabel::DateTime t); + gpsbabel::DateTime GetCreationTime() const; + void SetCreationTime(const gpsbabel::DateTime& t); void SetCreationTime(time_t t); void SetCreationTime(time_t t, int ms); geocache_data* AllocGCData(); diff --git a/main.cc b/main.cc index 622ae8076..57384b5d2 100644 --- a/main.cc +++ b/main.cc @@ -57,7 +57,7 @@ public: QargStackElement() = default; - QargStackElement(int p_argn, QStringList p_qargs) + QargStackElement(int p_argn, const QStringList& p_qargs) { argn = p_argn; qargs = p_qargs; diff --git a/src/core/datetime.h b/src/core/datetime.h index 518346b9f..c4a8299b2 100644 --- a/src/core/datetime.h +++ b/src/core/datetime.h @@ -46,8 +46,8 @@ public: setTime_t(0); } - DateTime(QDate date, QTime time) : QDateTime(date, time) {} - DateTime(QDateTime dt) : QDateTime(dt) {} + DateTime(const QDate& date, const QTime& time) : QDateTime(date, time) {} + DateTime(const QDateTime& dt) : QDateTime(dt) {} // TODO: this should go away in favor of .addSecs(). // add time_t without losing any existing milliseconds. diff --git a/waypt.cc b/waypt.cc index a0b13bd5b..825f68b53 100644 --- a/waypt.cc +++ b/waypt.cc @@ -706,7 +706,7 @@ Waypoint::GetCreationTime() const } void -Waypoint::SetCreationTime(gpsbabel::DateTime t) +Waypoint::SetCreationTime(const gpsbabel::DateTime& t) { creation_time = t; } -- 2.30.2